using System.Collections.Generic;
using System.Linq;
using System.Windows.Input;
using CharacterCreation.Data.Services;
using CharacterCreation.Views.Contracts;
using Microsoft.Practices.Prism.Commands;

namespace CharacterCreation.Views {
    /// <summary>
    /// The home view model
    /// </summary>
    public partial class HomeViewModel : BaseViewModel {

        /// <summary>
        /// The documents
        /// </summary>
        public IEnumerable<string> Documents {
            get {
                var feed = new GoogleService().DocumentsFeed;
                return feed.Entries.Select(e => e.Title.Text);
            }
        }

        /// <summary>
        /// Gets or sets the SelectedDocument
        /// </summary>
        public string SelectedDocument {
            get { return _SelectedDocument; }
            set {
                _SelectedDocument = value;
                RaisePropertyChanged("SelectedDocument");
            }
        }
        private string _SelectedDocument;

        public ICommand ImportCommand {
            get {
                return new DelegateCommand(() => {
                    ImportService service = new ImportService();
                    service.ImportAll();
                    //if (this.SelectedDocument.StartsWith("Skill")) {
                    //    SkillService skillService = SkillService.CreateInstance();
                    //    skillService.Import();
                    //}
                    //if (this.SelectedDocument.StartsWith("Character")) {
                    //    CharacterService characterService = CharacterService.CreateInstance();
                    //    characterService.Import();
                    //}
                    //if (this.SelectedDocument.StartsWith("Race")) {
                    //    RaceService raceService = RaceService.CreateInstance();
                    //    raceService.Import();
                    //}
                    //if (this.SelectedDocument.StartsWith("Special")) {
                    //    SpecialService specialService = SpecialService.CreateInstance();
                    //    specialService.Import();
                    //}
                    //if (this.SelectedDocument.StartsWith("Strength")) {
                    //    StrengthService strengthService = StrengthService.CreateInstance();
                    //    strengthService.Import();
                    //}
                    //if (this.SelectedDocument.StartsWith("Dexterity")) {
                    //    DexterityService dexterityService = DexterityService.CreateInstance();
                    //    dexterityService.Import();
                    //}
                    //if (this.SelectedDocument.StartsWith("Fighting")) {
                    //    FightingService fightingService = FightingService.CreateInstance();
                    //    fightingService.Import();
                    //}
                    //if (this.SelectedDocument.StartsWith("Constitution")) {
                    //    ConstitutionService constitutionService = ConstitutionService.CreateInstance();
                    //    constitutionService.Import();
                    //}
                    //if (this.SelectedDocument.StartsWith("Intelligence")) {
                    //    IntelligenceService intelligenceService = IntelligenceService.CreateInstance();
                    //    intelligenceService.Import();
                    //}
                    //if (this.SelectedDocument.StartsWith("WillPower")) {
                    //    WillPowerService willPowerService = WillPowerService.CreateInstance();
                    //    willPowerService.Import();
                    //}
                    //if (this.SelectedDocument.StartsWith("Charisma")) {
                    //    CharismaService charismaService = CharismaService.CreateInstance();
                    //    charismaService.Import();
                    //}
                });
            }
        }

        /// <summary>
        /// Constructor
        /// </summary>
        public HomeViewModel() { }


    }
}